<!--
 * @Autor: 黄旗
 * @Date: 2020-06-02 17:47:27
-->
<template>
    <Card>
        <Tabs v-model="Tabsname" :animated="false" @on-click="clickTabs(Tabsname)">
            <TabPane label="科室汇总表" name="1">
                <keshihuizonglist ref='keshihuizonglist'></keshihuizonglist>
            </TabPane>
            <TabPane label="复诊构成表" name="2">
                <fuzhenggouchenglist ref='fuzhenggouchenglist'></fuzhenggouchenglist>
            </TabPane>
        </Tabs>
    </Card>
</template>

<script>
    /* 这里导入其他文件：import 《组件名称》 from '《组件路径》 */
    import keshihuizonglist from './modules/keshihuizonglist'
    import fuzhenggouchenglist from './modules/fuzhenggouchenglist'
    export default {
        /* import引入的组件注入到components对象中使用 */
        components: { keshihuizonglist, fuzhenggouchenglist },
        data () {
            return {
                Tabsname: '1'
            };
        },
        /* 函数方法集合 */
        methods: {
            /* @函数功能: 初始化 */
            initial () {
                this.askData()
            },
            /* @函数功能: 请求数据 */
            askData () {
                this.$refs.keshihuizonglist.askData()
                this.$refs.keshihuizonglist.askData1()
            },
            /* @函数功能: 切换table */ 
            clickTabs (name) {
                if (name === '1') {
                    this.$refs.keshihuizonglist.askData()
                    this.$refs.keshihuizonglist.askData1()
                } else if (name === '2') {
                    this.$refs.fuzhenggouchenglist.initial()
                }
            }
        },
        /* 挂载完成能访问DOM元素 */
        mounted () { this.initial() }
    }
</script>
